package com.oromwin.repos.server.response;

import java.io.DataOutputStream;
import java.io.IOException;

import org.apache.commons.logging.Log;

import com.oromwin.repos.common.Logger;
import com.oromwin.repos.common.ReposException;
import com.oromwin.repos.common.helper.IOHelper;

public class NormalResponse implements Response {
    private Log log = Logger.getLog(NormalResponse.class);
    protected boolean Result = false;
    protected String Description = null;
    
    public NormalResponse() {
    }
    
    public NormalResponse(boolean result, String description) {
        Result = result;
        Description = description;
    }
    
    public boolean getResult() {
        return Result;
    }
    
    public String getDescription() {
        return Description;
    }
    
    public void send(DataOutputStream dos) throws ReposException {
        try {
            dos.writeBoolean(Result);
            IOHelper.writeUTF8(dos, Description.toString());
        } catch (IOException e) {
            throw ReposException.create(log, e);
        }
    }

}
